<!DOCTYPE html>
<html lang="en">
  <head>
    <title></title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <script src="../js/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <h2 id="v-once" v-once>v-once只会加载一次[{{meassage}}]</h2>
      <button @click="chanage(meassage)">定义方法传值messsage</button>
      <button @click="chanageval(meassage)">修改传值messsage</button>
      <textarea class="textarea" v-model="meassage"></textarea>
      <div id="html" v-html="url">vue 使用V-html</div>
      <!--
        v-bind 语法糖 :
      -->
      <img
        :src="image"
        :alt="meassage"
        title="百度一下"
        width="150"
        height="80"
      />
    </div>

    <script>
      var vue = new Vue({
        el: "#app",
        data: {
          meassage: "hello",
          url: '<a href="http://www.baidu.com/">点击百度</a>',
          image:
            "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png",
        },
        methods: {
          chanage: function (par) {
            alert(par);
          },
          chanageval: function (val) {
            if ((this.meassage = val)) {
              this.meassage = "修改完毕";
            }
          },
        },
      });
    </script>
  </body>
</html>
